package com.ymatou.authapp.service;

import java.util.HashMap;
import java.util.Map;

import org.json.JSONObject;

import com.ymt.base.YmatouBaseCall;
import com.ymt.core.tool.FormatUtil;
import com.ymttest.utils.EnvSetup;
/**
*查询用户凭据是否被非当前用户使用接口Call
*FreeMaker Template自动生成代码
*/
public class UserBillsExistsRequestDtoCall extends YmatouBaseCall{
	private static String opurl ="json/reply/UserBillsExistsRequestDto";
	
	public UserBillsExistsRequestDtoCall() {
		super(EnvSetup.getSystemUrl("api_authapp"),opurl,"GET","PARAM");
	}
	
	@Override
	public void addDefHeader() {
		client.addHeader("Accept","text/xml,text/javascript,text/html,application/json");
		client.addHeader("Content-Type", "application/json; charset=UTF-8");
	}
	
	/**
	 * 获取是否成功
	 * 
	 * @return Boolean
	 */
	public Boolean getSuccess() {
		Boolean Success = null;
		try {
			JSONObject jo = new JSONObject(getReturnData());
			Success = jo.getBoolean("Success");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Success;
	}
	
	/**
	 * 返回用户认证信息
	 * @return
	 */
	public Map<String,Boolean> getResult(){
		Map<String, Boolean> result = new HashMap<String, Boolean>();
		try{
			result = (Map) FormatUtil.GSONToObject(new JSONObject(getReturnData()).getString("Result"), Map.class);
		}catch(Exception e){
			e.printStackTrace();
		}
		return result;
	}
}